---
title: Troubleshooting in Effector
description: Error Fixing
lang: en
---

import Tabs from "@components/Tabs/Tabs.astro";
import TabItem from "@components/Tabs/TabItem.astro";
import SideBySide from "@components/SideBySide/SideBySide.astro";

# Troubleshooting Effector (#troubleshooting)

## Common Errors (#common-errors)

### `store: undefined is used to skip updates. To allow undefined as a value provide explicit { skipVoid: false } option` (#store-undefined)

This error indicates that you are trying to pass `undefined` as a value to your store, which might not be the intended behavior.

If you really need to store `undefined`, pass an object with `{ skipVoid: false }` as the second argument to `createStore`:

```ts
const $store = createStore(0, {
  skipVoid: false,
});
```

### `no handler used in [effect name]` (#no-handler-used)

This error occurs when calling an effect without a handler. Make sure you passed a handler to the `createEffect` method during creation, or later when using the `.use(handler)` method.

### `serialize: One or more stores dont have sids, their values are omitted` (#store-without-sid)

:::info{title="Before version 23.3.0"}
Before version 23.3.0, this error was also known as: `There is a store without sid in this scope, its value is omitted`.
:::

This error commonly occurs in SSR scenarios due to the absence of an `sid` (stable id), which is required for proper hydration of store data from the server to the client.

To fix this, add an `sid` to your store. You can do this in one of the following ways:

1. Use the [Babel](/en/api/effector/babel-plugin/) or [SWC](/en/api/effector/swc-plugin/) plugin to handle it automatically.
2. Manually specify an `sid` by providing an object with a `sid` property as the second argument to `createStore`:

   ```ts
   const $store = createStore(0, {
     sid: "unique id",
   });
   ```

For more details, see [Understanding `sid` and its purpose](/en/explanation/sids).

### `scopeBind: scope not found` (#scope-not-found)

This error occurs when a scope is lost at some point in execution, preventing `scopeBind` from associating an event or effect with the correct execution scope.<br/>
It may be caused by:

1. Using a "scope-free" mode where scopes are not present in your application.
2. Calling [units outside of a scope](#using-units-without-use-unit).

Possible Solutions:

1. Ensure `scopeBind` is used within effects:

   ```ts
   const event = createEvent();

   // ❌ - Do not call scopeBind inside callbacks
   const effectFx = createEffect(() => {
     setTimeout(() => {
       scopeBind(event)();
     }, 1111);
   });

   // ✅ - Use scopeBind inside the effect
   const effectFx = createEffect(() => {
     const scopeEvent = scopeBind(event);

     setTimeout(() => {
       scopeEvent();
     }, 1111);
   });
   ```

2. Ensure that your units are used inside a scope:
   - When working with a framework, use `useUnit`.
   - If calling an event or effect outside a framework, use `allSettled` and provide the appropriate `scope` as an argument.

If necessary, and you want to suppress the error, you can pass `{ safe: true }` as an option:

```ts
const scopeEvent = scopeBind(event, {
  safe: true,
});
```

### `call of derived event is not supported, use createEvent instead` (#call-of-derived-event-is-not-supported)

This error occurs when you try to call a derived event as a function. Derived events are created by methods like `.map()`, `.filter()`, `.filterMap()`, as well as the `sample` operator.

To fix this, use an event created via `createEvent`.

### `unit call from pure function is not supported, use operators like sample instead` (#unit-call-from-pure-not-supported)

This error occurs when you try to call events or effects from [pure functions](/en/explanation/glossary#purity) in Effector:

- **Calling events in event methods**<br/>
  When you try to call one event inside another event's `.map()`, `.filter()`, `.filterMap()`, or `.prepend()` methods.

- **Calling events in store handlers**<br/>
  When attempting to call an event in a [`.on()`](/en/api/effector/Store#methods-on-trigger-reducer) handler, inside the [`.map()`](/en/api/effector/Store#methods-map-fn) method, or in the [`updateFilter()`](/en/api/effector/createStore#createStore-formulae) configuration property of a store.

- **Calling events in `sample` functions**<br/>
  When calling an event in the `fn` or `filter` function of the `sample` operator.

How to fix: Instead of calling events in pure functions, use declarative operators, for example, `sample`.

## Gotchas (#gotchas)

### `sample.fn` does not narrow the type passed from `sample.filter` (#sample-types-error)

A common type-related issue with `sample` occurs when a check is performed in `filter`, but `fn` does not receive the correctly narrowed type. To resolve this, you can add [type predicates](/en/essentials/typescript#typing-sample-filter-and-fn) or use the [`effector-action`](https://github.com/AlexeyDuybo/effector-action) library, which helps simplify conditional types:

<SideBySide>
<Fragment slot="left">

```tsx wrap data-height="full"
import { sample } from "effector";

const messageSent = createEvent<Message>();
const userText = createEvent<string>();

sample({
  clock: messageSent,
  filter: (msg: Message): msg is UserMessage => msg.kind === "user",
  fn: (msg) => msg.text,
  target: userText,
});
```

</Fragment>
<Fragment slot="right">

```tsx wrap data-height="full"
import { createAction } from "effector-action";

const userText = createEvent<string>();

const messageSent = createAction({
  target: userText,
  fn: (userText, msg: Message) => {
    if (msg.kind === "user") {
      userText(msg.txt);
    }
  },
});
```

</Fragment>
</SideBySide>

### My state did not change (#my-state-not-changed)

If your state does not update as expected, you are likely [working with scopes](/en/advanced/work-with-scope) and, at some point, [the active scope was lost](/en/guides/scope-loss). As a result, your unit executed in the global scope instead.<br/>

Typical places where this happens:

- `setTimeout` / `setInterval`
- `addEventListener`
- [`WebSocket`](/en/guides/websocket-integration)
- [direct promise calls inside effects](/en/advanced/work-with-scope#scope-rules)
- third-party libraries with async APIs or callbacks.

**Solution**:
[Bind your event or effect to the current scope using `scopeBind`](/en/guides/scope-loss#how-to-fix-scope-loss):

<SideBySide>
<Fragment slot="left">

```tsx wrap data-border="good" data-height="full" ins={6} "scopedEvent"
// ✅ correct way

const event = createEvent();

const effectFx = createEffect(() => {
  const scopedEvent = scopeBind(event);

  setTimeout(() => {
    scopedEvent();
  }, 1000);
});
```

</Fragment>
<Fragment slot="right">

```tsx wrap data-border="bad" data-height="full"
// ❌ event will execute in the global scope

const event = createEvent();

const effectFx = createEffect(() => {
  setTimeout(() => {
    event();
  }, 1000);
});
```

</Fragment>
</SideBySide>

#### Using units without `useUnit` (#using-units-without-use-unit)

If you're using events or effects in a framework without `useUnit`, this may also lead to [scope loss](/en/guides/scope-loss).<br/>
To fix this, pass the unit to the `useUnit` hook and use the returned value:

<SideBySide>
<Fragment slot="left">

```tsx wrap data-border="good" data-height="full" ins={4,7} "onEvent"
// ✅ hook used

import { event } from "./model.js";
import { useUnit } from "effector-react";

const Component = () => {
  const onEvent = useUnit(event);

  return <button onClick={() => onEvent()}>click me</button>;
};
```

</Fragment>
<Fragment slot="right">

```tsx wrap data-border="bad" data-height="full"
// ❌ direct unit call

import { event } from "./model.js";

const Component = () => {
  return <button onClick={() => event()}>click me</button>;
};
```

</Fragment>
</SideBySide>

:::info{title="Best Practice"}
[Using `useUnit` is the recommended approach](/en/guides/best-practices#use-unit) for working with units.
:::

## No Answer to Your Question? (#community)

If you couldn't find the answer to your question, you can always ask the community:

- [RU Telegram](https://t.me/effector_ru)
- [EN Telegram](https://t.me/effector_en)
- [Discord](https://discord.gg/t3KkcQdt)
- [Reddit](https://www.reddit.com/r/effectorjs/)
